import {createStore,applyMiddleware,compose} from 'redux'
import reducer from './reducer'
import thunk from 'redux-thunk'
import createSagaMiddleware from 'redux-saga'
import {mysaga,mysaga1,mysaga2,mysaga3,mysaga4} from './sagas/saga'



const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) : compose;
//使用redux-saga中间件
const sagaMiddleware = createSagaMiddleware()
const enhancer = composeEnhancers(applyMiddleware(thunk),applyMiddleware(sagaMiddleware));
const store = createStore(reducer,enhancer);
//使用saga中间件
sagaMiddleware.run(mysaga);
sagaMiddleware.run(mysaga1);
sagaMiddleware.run(mysaga2);
sagaMiddleware.run(mysaga3);
sagaMiddleware.run(mysaga4);
export default store;